]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
endSessionDialog: Initialize Polkit permission asynchronously
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 23 Aug 2019 12:48:36 +0000 (14:48 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 1 Sep 2019 10:45:49 +0000 (12:45 +0200)
The updatesPermission is currently initialized synchronously, which
blocks the Mainloop for quite some time and therefore slows down startup
of the shell, let's do it asynchronously instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/689

js/ui/endSessionDialog.js

index 0b475b6f966c5ca2573edbcfa4e7b7dcf79288fd..f51eb7bee09d8a6823965a9f2d867552043b8f7c 100644 (file)
@@ -352,12 +352,15 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
         }
 
         // It only makes sense to check for this permission if PackageKit is available.
-        try {
-            this._updatesPermission = Polkit.Permission.new_sync(
-                'org.freedesktop.packagekit.trigger-offline-update', null, null);
-        } catch (e) {
-            log('No permission to trigger offline updates: %s'.format(e.toString()));
-        }
+        Polkit.Permission.new(
+            'org.freedesktop.packagekit.trigger-offline-update', null, null,
+            (source, res) => {
+                try {
+                    this._updatesPermission = Polkit.Permission.new_finish(res);
+                } catch (e) {
+                    log(`No permission to trigger offline updates: ${e}`);
+                }
+            });
     }
 
     _onDestroy() {